Paging is a technique used in many virtual memory computer systems for managing virtual memory as fixed-length blocks called pages. An example of a system which supports a paged memory environment is the IBM OS/2 V 2.0 operating system.
The transfer of data between paged primary storage and secondary storage in the form of a data storage device is advantageously performed by Direct memory Access (DMA), which is a technique for moving data by means of a DMA controller, without any interaction from the processor. DMA operations are initiated by the processor, but do not require the processor for the data transfer. A DMA device is a device which incorporates a DMA controller and is thus able to transfer data directly from the disk to primary storage by DMA.
A paged memory environment poses a problem for devices that rely on DMA for data transfers. Most existing DMA devices assume that physical memory is contiguous. In the paged environment, however, I/O buffers that are contiguous in the virtual address space are usually composed of discontiguous physical pages. Scatter-gather I/O is a mechanism for transferring blocks of data to and from a buffer whose pages are physically discontiguous. A gather write operation writes a physically discontiguous I/O buffer to a contiguous range of sectors on the secondary medium. A scatter-read operation reads a contiguous range of sectors from the secondary medium to a physically discontiguous buffer.
DMA devices that support scatter-gather are able to DMA all data specified in an I/O request straight into primary storage, with the scatter-gather hardware contained therein determining the location in physical memory into which the data is to be transferred. In OS/2 V 2.0, the kernel generates scatter-gather list which maps the contiguous virtual address to discontiguous physical addresses. The device driver associated with a DMA device that supports scatter-gather uses this list to DMA the requested data between storage and primary storage. An example of a DMA device which implements scatter-gather is the IBM PS/2 SCSI adapter.
For those peripheral devices that do not support scatter-gather, one mechanism employed to move data from a secondary storage device to primary storage is for the whole I/O request to be read into an intermediate buffer, from where it is copied into the Application address space. For a write operation, the whole I/O request is copied into the intermediate buffer and then written to storage, in order to make optimum else of the device, there will commonly be three I/O operations being processed concurrently. These are (i) the I/O operation currently being performed, (ii) the I/O operation which has just completed and returning status and (iii) the I/O operation being prepared for when the current I/O completes. Thus, to make optimum use of the device, it may be necessary to provide three intermediate buffers per disk, each one of which may need to be large enough to buffer a whole I/O operation. If only one buffer is allocated per disk then only one I/O operation can be performed at once thus impacting the disk to primary storage data transfer rate. Furthermore, there is an increase in processor overhead due to the large amount of data that is copied by the processor into or out of the intermediate buffer.
In the OS/2 V2.0 environment, the OS/2 kernel recognizes from the device driver that the device does not support scatter-gather and accordingly the generated scatter-gather list will contain only entry.